package com.persia.tool;

import org.apache.commons.configuration.PropertiesConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 读取配置文件
 * src/main/resources/appconfig.properties
 * 设计为单例
 * @author: caibosi
 * @created: 2013-11-10
 */
public class ConfigTool {

    private static PropertiesConfiguration propertyUtil = null;
    private static Logger logger = LoggerFactory.getLogger(ConfigTool.class);

    static{
        try {
            propertyUtil = new PropertiesConfiguration("appconfig.properties");
        } catch (Exception e) {
            logger.error("read config files error",e);
        }

        logger.info("reading app config file ......");
    }

    public static PropertiesConfiguration getConfig(){
        return propertyUtil;
    }
}
